package trans;

import java.util.HashMap;
import data.OpLogBean;
import data.OpLogDao;
import java.util.List;

import utils.UtilsBean;

public class OplogTrans extends BaseTransBean{
	private int result;
	private String message;
	
	public OplogTrans(){
		super(false);
	}

	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public int getResult() {
		return result;
	}
	public void setResult(int result) {
		this.result = result;
	}

	public int countByParams(String deptno, String mgrno, String opcode,
		String opterm, String startdate, String enddate){
		HashMap<String,Object> params = new HashMap<String,Object>();
		params.clear();
		params.put("deptno", deptno);
		params.put("mgrno", mgrno);
		params.put("opcode", opcode);
		params.put("opterm", opterm);
		params.put("startdate", startdate);
		params.put("enddate", enddate);
		try{
			result = 0;
			return OpLogDao.countByParams(getDaoSession(), params);
		}
		catch(Exception e){
			e.printStackTrace();
			UtilsBean.writeErrStack(e);
			message = e.getMessage();
			result = -1;
			return -1;
		}
	}
	
	public List<OpLogBean> selectByParams(String deptno, String mgrno, 
		String opcode, String opterm, String startdate, 
		String enddate, int offset, int limit){
		HashMap<String,Object> params = new HashMap<String,Object>();
		params.clear();
		params.put("deptno", deptno);
		params.put("mgrno", mgrno);
		params.put("opcode", opcode);
		params.put("opterm", opterm);
		params.put("startdate", startdate);
		params.put("enddate", enddate);
			
		try{
			result = 0;
			return (List<OpLogBean>)OpLogDao.selectByParams(
				getDaoSession(), params, offset, limit);
		}
		catch(Exception e){
			e.printStackTrace();
			UtilsBean.writeErrStack(e);
			message = e.getMessage();
			result = -1;
			return null;
		}
	}
}
